# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Hugo Osvaldo Barrera <hugo@barrera.io>

_name=aiohttp-oauthlib
pkgname=python-aiohttp-oauthlib
pkgver=0.1.0
pkgrel=3
pkgdesc='oauthlib for aiohttp clients'
arch=('any')
url=https://git.sr.ht/~whynothugo/aiohttp-oauthlib
license=('ISC')
depends=('python-aiohttp' 'python-oauthlib')
makedepends=('python-build' 'python-installer' 'python-setuptools-scm'
             'python-wheel')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz")
sha256sums=('893cd1a59ddd0c2e4e980e3a544f9710b7c4ffb9e27b4cd038b51fe1d70393b7')
b2sums=('2925aeab72f7d38bb819646cf232278d93adb0a0375bc97fd6cfc133cbafc5e5fa87bfcfc8dd9056fe84ab4d3b5af3a57fbc0441b3c9f521ff7ffb6bb2598f3a')

build() {
  cd $_name-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/aiohttp_oauthlib-$pkgver.dist-info/LICENCE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENCE
}
